#pragma once

#include <AVUIDecorator.h>

namespace AVUI {

class Viewbox : public Decorator
{
public:

    virtual ~Viewbox() { }

    DECLARE_ELEMENT(Viewbox, Decorator);

    DECLARE_DEPENDENCY_PROPERTY(Stretch);
    Stretch::Enum get_Stretch() { return (Stretch::Enum) AVUI::UnboxValue<int>(GetValue(get_StretchProperty())); }
    void set_Stretch(Stretch::Enum value) { SetValue(get_StretchProperty(), AVUI::BoxValue<int>(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(StretchDirection);
    StretchDirection::Enum get_StretchDirection() { return (StretchDirection::Enum) AVUI::UnboxValue<int>(GetValue(get_StretchDirectionProperty())); }
    void set_StretchDirection(StretchDirection::Enum value) { SetValue(get_StretchDirectionProperty(), AVUI::BoxValue<int>(value)); } 

    static Size ComputeScaleFactor(const Size& availableSize, const Size& contentSize, Stretch::Enum stretch, StretchDirection::Enum stretchDirection);

protected:

    virtual Size MeasureOverride(const Size& constraintSize);
    virtual Size ArrangeOverride(const Size& constraintSize);

private:
    static void StaticConstructor();

};


}; // namespace AVUI
